package com.cloudcc.mobile.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.cloudcc.cloudframe.adapter.CommonAdapter;
import com.cloudcc.cloudframe.adapter.ViewHolder;
import com.cloudcc.mobile.R;
import com.cloudcc.mobile.entity.beau.BeauListEntity;
import com.cloudcc.mobile.view.fragment.BeauListFragmentType;
import com.cloudcc.mobile.weight.SwipeLayout;
import com.cloudcc.mobile.weight.SwipeLayout.OnSwipeSlideListener;
import com.litesuits.android.log.Log;

/**
 * @Description: 对象列表适配器
 * @author wangzhiqiang
 * @date 2015-11-18 上午11:05:26
 * 
 */
public class BeauListAdapterType extends CommonAdapter<BeauListEntity> {
	private String mEntityId;
	private int[] mSlideItemArray = new int[] { -1, -2 };

	private BeauListFragmentType mOnItemMenuClickListener;

	private BeauListFragmentType mOnClickItem;

	public BeauListFragmentType getmOnClickItem() {
		return mOnClickItem;
	}

	public void setmOnClickItem(BeauListFragmentType beauListFragmentType) {
		this.mOnClickItem = beauListFragmentType;
	}

	public BeauListAdapterType(Context mContext, String mEntityId) {
		super(mContext);
		this.mEntityId = mEntityId;
	}

	public void resetMenu() {
		if (mSlideItemArray[0] != -1 || mSlideItemArray[1] != -2) {
			mSlideItemArray[0] = -1;
			mSlideItemArray[1] = -2;
			notifyDataSetChanged();
		}
	}

	public class check {
		public int checkposition;
		public boolean ischeck;
	}

	@Override
	public void convert(ViewHolder holder, BeauListEntity t) {
		Log.d("getValue", t.getName() + "key  " + t.getKey() + t.getValue());

		// if (t.getName() == null | "".equals(t.getName())) {
		// return;
		// }
		// list是前面的標籤value
		List<String> list = new ArrayList<String>();
		// // //後面的內容key
		List<String> list1 = new ArrayList<String>();
		// //
		if ((t.getKey() == null) | ("".equals(t.getKey()))) {
			Log.d("pankong", "key是空的");
		}
		if ((t.getValue() == null) | ("".equals(t.getValue()))) {
			Log.d("pankong", "value是空的");
		}
		String key[] = t.getKey().split("\\*", -1);
		Log.d("keylenth", key.length + "::" + t.getKey());
		Log.d("pankong", "key不是空的");
		String value[] = t.getValue().split(",");
		Log.d("pankong", "value不是空的");
		for (int i = 0; i < key.length; i++) {
			String string = key[i];

			Log.d("value", string + "sdcs" + key.length + (string == "null"));
			if ("null".equals(string)) {
				string = " ";
			}
			list1.add(string);
			Log.d("pankong", "走到这里了为嘛出错");
		}
		int length = 0;
		for (int i = 0; i < value.length; i++) {
			String dataitem = value[i].substring(1, value[i].length() - 1)
					+ ":";
			list.add(dataitem);
			length = length > dataitem.length() ? length : dataitem.length();
			Log.d("dataitem", dataitem.length() + "   " + "name" + "  "
					+ value.length + "长度是" + length);
			if (length > 8) {
				length = 8;
			}
		}
		// 判断是否check
		List<check> Check = new ArrayList<check>();
		for (int i = 0; i < list1.size(); i++) {
			Log.d("checkbox",
					"true" + ("true".equals(list1.get(i)))
							+ (list1.get(i) == "true") + "false"
							+ ("false".equals(list1.get(i)))
							+ (list1.get(i) == "false"));
			if (("true".equals(list1.get(i))) || (list1.get(i) == "true")) {
				check che = new check();
				che.checkposition = i;
				che.ischeck = true;
				Check.add(che);
			} else if (("false".equals(list1.get(i)))
					|| (list1.get(i) == "false")) {
				check che = new check();
				che.checkposition = i;
				che.ischeck = false;
				Check.add(che);
			}

		}
		boolean is1 = false, is11 = false, is22 = false, is33 = false, is2 = false, is3 = false,is4 = false,is44 = false,is5 = false,is55 = false,is6 = false, is66 = false, is7 = false, is77 = false, is8 = false, is88 = false,is9 = false,is99 = false,is10 = false,is1010 = false;
//		if (Check.size() > 0) {
//			for (int i = 0; i < Check.size(); i++) {
//				if (Check.get(i).checkposition == 0) {
//					is1 = true;
//					is11 = Check.get(i).ischeck;
//				} else if (Check.get(i).checkposition == 1) {
//					is2 = true;
//					is22 = Check.get(i).ischeck;
//				} else if (Check.get(i).checkposition == 2) {
//					is3 = true;
//					is33 = Check.get(i).ischeck;
//				}else if (Check.get(i).checkposition == 3) {
//					is4 = true;
//					is44 = Check.get(i).ischeck;
//				}else if (Check.get(i).checkposition == 4) {
//					is5 = true;
//					is55 = Check.get(i).ischeck;
//				}else if (Check.get(i).checkposition == 5) {
//					is6 = true;
//					is66 = Check.get(i).ischeck;
//				}else if (Check.get(i).checkposition == 6) {
//					is7 = true;
//					is77 = Check.get(i).ischeck;
//				}else if (Check.get(i).checkposition == 7) {
//					is8 = true;
//					is88 = Check.get(i).ischeck;
//				}else if (Check.get(i).checkposition == 8) {
//					is9 = true;
//					is99 = Check.get(i).ischeck;
//				}else if (Check.get(i).checkposition == 9) {
//					is10 = true;
//					is1010 = Check.get(i).ischeck;
//				}
//				else{
//					Log.d("check", "没有check");
//				}0
//			}
//		} else {
			is1 = false;
			is2 = false;
			is3 = false;
			is4 = false;
			is5 = false;
			is6 = false;
			is7 = false;
			is8 = false;
			is9 = false;
			is10 = false;
//		}
		holder.setText(R.id.tvname, t.getName());
		
		if (list.size() < 1) {
//			holder.setwidth(R.id.tv1, length);
			holder.setText(R.id.tv1, t.getName());
			holder.setText(R.id.tv7, t.getCreatedate());
			holder.setVisibility(R.id.tv2, 8);
			holder.setVisibility(R.id.ll2, 8);
			holder.setVisibility(R.id.ll3, 8);
			holder.setVisibility(R.id.ll4, 8);
			holder.setVisibility(R.id.ll5, 8);
			holder.setVisibility(R.id.ll6, 8);
			holder.setVisibility(R.id.ll7, 8);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);
			// holder.setVisibility(R.id.box1, 8);
		}
		if (list.size() == 1) {
			if (("true".equals(list1.get(0))) || (list1.get(0) == "true")) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, true);
			} else if (("flase".equals(list1.get(0)))
					|| (list1.get(0) == "false")) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, false);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if("name".equals(list1.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 8);
			holder.setVisibility(R.id.ll3, 8);
			holder.setVisibility(R.id.ll4, 8);
			holder.setVisibility(R.id.ll5, 8);
			holder.setVisibility(R.id.ll6, 8);
			holder.setVisibility(R.id.ll7, 8);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);
		}

		if (list.size() == 2) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
//			holder.setwidth(R.id.tv1, length);
//			holder.setwidth(R.id.tv3, length);
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 8);
			holder.setVisibility(R.id.ll4, 8);
			holder.setVisibility(R.id.ll5, 8);
			holder.setVisibility(R.id.ll6, 8);
			holder.setVisibility(R.id.ll7, 8);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);
		}
		if (list.size() == 3) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
//			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 8);
			holder.setVisibility(R.id.ll5, 8);
			holder.setVisibility(R.id.ll6, 8);
			holder.setVisibility(R.id.ll7, 8);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);

		}
		if (list.size() == 4) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if(is4){
				holder.setCheckbox(R.id.box4, is44);
				holder.setText(R.id.tv42, " ");
			}else{
				holder.setVisibility(R.id.box4, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setText(R.id.tv41, list.get(3));
			holder.setText(R.id.tv42, list1.get(3));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 0);
			holder.setVisibility(R.id.ll5, 8);
			holder.setVisibility(R.id.ll6, 8);
			holder.setVisibility(R.id.ll7, 8);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);

		}
		
		if (list.size() == 5) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if(is4){
				holder.setCheckbox(R.id.box4, is44);
				holder.setText(R.id.tv42, " ");
			}else{
				holder.setVisibility(R.id.box4, 8);
			}
			if(is5){
				holder.setCheckbox(R.id.box5, is55);
				holder.setText(R.id.tv52, " ");
			}else{
				holder.setVisibility(R.id.box5, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setText(R.id.tv41, list.get(3));
			holder.setText(R.id.tv42, list1.get(3));
			holder.setText(R.id.tv51, list.get(4));
			holder.setText(R.id.tv52, list1.get(4));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 0);
			holder.setVisibility(R.id.ll5, 0);
			holder.setVisibility(R.id.ll6, 8);
			holder.setVisibility(R.id.ll7, 8);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);

		}
		if (list.size() == 6) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if(is4){
				holder.setCheckbox(R.id.box4, is44);
				holder.setText(R.id.tv42, " ");
			}else{
				holder.setVisibility(R.id.box4, 8);
			}
			if(is5){
				holder.setCheckbox(R.id.box5, is55);
				holder.setText(R.id.tv52, " ");
			}else{
				holder.setVisibility(R.id.box5, 8);
			}
			if(is6){
				holder.setCheckbox(R.id.box6, is66);
				holder.setText(R.id.tv62, " ");
			}else{
				holder.setVisibility(R.id.box6, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setText(R.id.tv41, list.get(3));
			holder.setText(R.id.tv42, list1.get(3));
			holder.setText(R.id.tv51, list.get(4));
			holder.setText(R.id.tv52, list1.get(4));
			holder.setText(R.id.tv61, list.get(5));
			holder.setText(R.id.tv62, list1.get(5));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 0);
			holder.setVisibility(R.id.ll5, 0);
			holder.setVisibility(R.id.ll6, 0);
			holder.setVisibility(R.id.ll7, 8);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);

		}
		if (list.size() == 7) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if(is4){
				holder.setCheckbox(R.id.box4, is44);
				holder.setText(R.id.tv42, " ");
			}else{
				holder.setVisibility(R.id.box4, 8);
			}
			if(is5){
				holder.setCheckbox(R.id.box5, is55);
				holder.setText(R.id.tv52, " ");
			}else{
				holder.setVisibility(R.id.box5, 8);
			}
			if(is6){
				holder.setCheckbox(R.id.box6, is66);
				holder.setText(R.id.tv62, " ");
			}else{
				holder.setVisibility(R.id.box6, 8);
			}
			if(is7){
				holder.setCheckbox(R.id.box7, is77);
				holder.setText(R.id.tv72, " ");
			}else{
				holder.setVisibility(R.id.box7, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setText(R.id.tv41, list.get(3));
			holder.setText(R.id.tv42, list1.get(3));
			holder.setText(R.id.tv51, list.get(4));
			holder.setText(R.id.tv52, list1.get(4));
			holder.setText(R.id.tv61, list.get(5));
			holder.setText(R.id.tv62, list1.get(5));
			holder.setText(R.id.tv71, list.get(6));
			holder.setText(R.id.tv72, list1.get(6));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 0);
			holder.setVisibility(R.id.ll5, 0);
			holder.setVisibility(R.id.ll6, 0);
			holder.setVisibility(R.id.ll7, 0);
			holder.setVisibility(R.id.ll8, 8);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);

		}
		if (list.size() ==8) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if(is4){
				holder.setCheckbox(R.id.box4, is44);
				holder.setText(R.id.tv42, " ");
			}else{
				holder.setVisibility(R.id.box4, 8);
			}
			if(is5){
				holder.setCheckbox(R.id.box5, is55);
				holder.setText(R.id.tv52, " ");
			}else{
				holder.setVisibility(R.id.box5, 8);
			}
			if(is6){
				holder.setCheckbox(R.id.box6, is66);
				holder.setText(R.id.tv62, " ");
			}else{
				holder.setVisibility(R.id.box6, 8);
			}
			if(is7){
				holder.setCheckbox(R.id.box7, is77);
				holder.setText(R.id.tv72, " ");
			}else{
				holder.setVisibility(R.id.box7, 8);
			}
			if(is8){
				holder.setCheckbox(R.id.box8, is88);
				holder.setText(R.id.tv82, " ");
			}else{
				holder.setVisibility(R.id.box8, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setText(R.id.tv41, list.get(3));
			holder.setText(R.id.tv42, list1.get(3));
			holder.setText(R.id.tv51, list.get(4));
			holder.setText(R.id.tv52, list1.get(4));
			holder.setText(R.id.tv61, list.get(5));
			holder.setText(R.id.tv62, list1.get(5));
			holder.setText(R.id.tv71, list.get(6));
			holder.setText(R.id.tv72, list1.get(6));
			holder.setText(R.id.tv81, list.get(7));
			holder.setText(R.id.tv82, list1.get(7));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 0);
			holder.setVisibility(R.id.ll5, 0);
			holder.setVisibility(R.id.ll6, 0);
			holder.setVisibility(R.id.ll7, 0);
			holder.setVisibility(R.id.ll8, 0);
			holder.setVisibility(R.id.ll9, 8);
			holder.setVisibility(R.id.ll10, 8);

		}
		if (list.size() ==9) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if(is4){
				holder.setCheckbox(R.id.box4, is44);
				holder.setText(R.id.tv42, " ");
			}else{
				holder.setVisibility(R.id.box4, 8);
			}
			if(is5){
				holder.setCheckbox(R.id.box5, is55);
				holder.setText(R.id.tv52, " ");
			}else{
				holder.setVisibility(R.id.box5, 8);
			}
			if(is6){
				holder.setCheckbox(R.id.box6, is66);
				holder.setText(R.id.tv62, " ");
			}else{
				holder.setVisibility(R.id.box6, 8);
			}
			if(is7){
				holder.setCheckbox(R.id.box7, is77);
				holder.setText(R.id.tv72, " ");
			}else{
				holder.setVisibility(R.id.box7, 8);
			}
			if(is8){
				holder.setCheckbox(R.id.box8, is88);
				holder.setText(R.id.tv82, " ");
			}else{
				holder.setVisibility(R.id.box8, 8);
			}
			if(is9){
				holder.setCheckbox(R.id.box9, is99);
				holder.setText(R.id.tv92, " ");
			}else{
				holder.setVisibility(R.id.box9, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setText(R.id.tv41, list.get(3));
			holder.setText(R.id.tv42, list1.get(3));
			holder.setText(R.id.tv51, list.get(4));
			holder.setText(R.id.tv52, list1.get(4));
			holder.setText(R.id.tv61, list.get(5));
			holder.setText(R.id.tv62, list1.get(5));
			holder.setText(R.id.tv71, list.get(6));
			holder.setText(R.id.tv72, list1.get(6));
			holder.setText(R.id.tv81, list.get(7));
			holder.setText(R.id.tv82, list1.get(7));
			holder.setText(R.id.tv91, list.get(8));
			holder.setText(R.id.tv92, list1.get(8));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 0);
			holder.setVisibility(R.id.ll5, 0);
			holder.setVisibility(R.id.ll6, 0);
			holder.setVisibility(R.id.ll7, 0);
			holder.setVisibility(R.id.ll8, 0);
			holder.setVisibility(R.id.ll9, 0);
			holder.setVisibility(R.id.ll10, 8);

		}
		if (list.size() >=10) {
			if (is1) {
				holder.setText(R.id.tv2, " ");
				holder.setCheckbox(R.id.box1, is11);
			} else {
				holder.setVisibility(R.id.box1, 8);
			}
			if (is2) {
				holder.setCheckbox(R.id.box2, is22);
				holder.setText(R.id.tv4, " ");
			} else {
				holder.setVisibility(R.id.box2, 8);
			}
			if(is3){
				holder.setCheckbox(R.id.box3, is33);
				holder.setText(R.id.tv6, " ");
			}else{
				holder.setVisibility(R.id.box3, 8);
			}
			if(is4){
				holder.setCheckbox(R.id.box4, is44);
				holder.setText(R.id.tv42, " ");
			}else{
				holder.setVisibility(R.id.box4, 8);
			}
			if(is5){
				holder.setCheckbox(R.id.box5, is55);
				holder.setText(R.id.tv52, " ");
			}else{
				holder.setVisibility(R.id.box5, 8);
			}
			if(is6){
				holder.setCheckbox(R.id.box6, is66);
				holder.setText(R.id.tv62, " ");
			}else{
				holder.setVisibility(R.id.box6, 8);
			}
			if(is7){
				holder.setCheckbox(R.id.box7, is77);
				holder.setText(R.id.tv72, " ");
			}else{
				holder.setVisibility(R.id.box7, 8);
			}
			if(is8){
				holder.setCheckbox(R.id.box8, is88);
				holder.setText(R.id.tv82, " ");
			}else{
				holder.setVisibility(R.id.box8, 8);
			}
			if(is9){
				holder.setCheckbox(R.id.box9, is99);
				holder.setText(R.id.tv92, " ");
			}else{
				holder.setVisibility(R.id.box9, 8);
			}
			if(is10){
				holder.setCheckbox(R.id.box10, is1010);
				holder.setText(R.id.tv102, " ");
			}else{
				holder.setVisibility(R.id.box10, 8);
			}
			if("名称".equals(list.get(0))){
				holder.setVisibility(R.id.tv1, 8);
			}else{
				holder.setVisibility(R.id.tv1, 0);
			}
//			holder.setText(R.id.tv1, list.get(0));
			holder.setText(R.id.tv2, list1.get(0));
			holder.setText(R.id.tv3, list.get(1));
			holder.setText(R.id.tv4, list1.get(1));
			holder.setText(R.id.tv5, list.get(2));
			holder.setText(R.id.tv6, list1.get(2));
			holder.setText(R.id.tv41, list.get(3));
			holder.setText(R.id.tv42, list1.get(3));
			holder.setText(R.id.tv51, list.get(4));
			holder.setText(R.id.tv52, list1.get(4));
			holder.setText(R.id.tv61, list.get(5));
			holder.setText(R.id.tv62, list1.get(5));
			holder.setText(R.id.tv71, list.get(6));
			holder.setText(R.id.tv72, list1.get(6));
			holder.setText(R.id.tv81, list.get(7));
			holder.setText(R.id.tv82, list1.get(7));
			holder.setText(R.id.tv91, list.get(8));
			holder.setText(R.id.tv92, list1.get(8));
			holder.setText(R.id.tv101, list.get(9));
			holder.setText(R.id.tv102, list1.get(9));
			holder.setVisibility(R.id.ll1, 0);
			holder.setVisibility(R.id.ll2, 0);
			holder.setVisibility(R.id.ll3, 0);
			holder.setVisibility(R.id.ll4, 0);
			holder.setVisibility(R.id.ll5, 0);
			holder.setVisibility(R.id.ll6, 0);
			holder.setVisibility(R.id.ll7, 0);
			holder.setVisibility(R.id.ll8, 0);
			holder.setVisibility(R.id.ll9, 0);
			holder.setVisibility(R.id.ll10, 0);


		}
		if(t.getIsname()==1){
			holder.setVisibility(R.id.ll1, 8);
		}else if(t.getIsname()==2){
			holder.setVisibility(R.id.ll2, 8);
		}else if(t.getIsname()==3){
			holder.setVisibility(R.id.ll3, 8);
		}else if(t.getIsname()==4){
			holder.setVisibility(R.id.ll4, 8);
		}else if(t.getIsname()==5){
			holder.setVisibility(R.id.ll5, 8);
		}else if(t.getIsname()==6){
			holder.setVisibility(R.id.ll6, 8);
		}else if(t.getIsname()==7){
			holder.setVisibility(R.id.ll7, 8);
		}else if(t.getIsname()==8){
			holder.setVisibility(R.id.ll8, 8);
		}
		else if(t.getIsname()==9){
			holder.setVisibility(R.id.ll9, 8);
		}else if(t.getIsname()==10){
			holder.setVisibility(R.id.ll10, 8);
		}else{
			holder.setVisibility(R.id.llname, 8);
			
		}
		
		SwipeLayout swipeContainer = holder.getView(R.id.swipe);
		if (mSlideItemArray[0] == holder.getPostion()) {
			swipeContainer.openMenu();
		} else if (mSlideItemArray[1] == holder.getPostion()) {
			swipeContainer.closeMenu();
		} else {
			swipeContainer.cloaseMenuWithOutAnt();
		}

		final int ops = holder.getPostion();
		swipeContainer.setOnSwipeSlideListener(new OnSwipeSlideListener() {
			@Override
			public void onOpen(SwipeLayout swipe) {
				setCurrentSlideItem(ops);
			}

			@Override
			public void onClose(SwipeLayout swipe) {
			}

		});
		final BeauListEntity entity = t;

		Log.d("beau_call",
				mEntityId + "   " + t.getPhone() + " phone" + t.getDianhua()
						+ "电话" + t.getShouji() + "手機");
		boolean iscall = true;
		;
		if ("lead".equals(mEntityId)) {// 潛在客戶
			iscall = TextUtils.isEmpty(t.getPhone());
		} else if ("account".equals(mEntityId)) {// 客戶
			iscall = TextUtils.isEmpty(t.getDianhua());
		} else if ("contact".equals(mEntityId)) {// 聯繫人
			iscall = TextUtils.isEmpty(t.getShouji());
		}
		holder.getView(R.id.beau_call).setVisibility(
				iscall ? View.GONE : View.VISIBLE);
		Log.d("daodichubuchulai", "从这里走了1" + iscall);
		holder.getView(R.id.beau_call).setOnClickListener(
				new OnClickListener() {
					@Override
					public void onClick(View v) {
						Log.d("daodichubuchulai", "从这里走了2");
						if (mOnItemMenuClickListener != null) {
							Log.d("daodichubuchulai", "从这里走了sdfnsdjfvbsdjkj");
							mOnItemMenuClickListener.onClickPhone(ops, entity);
						}
					}
				});
		holder.getView(R.id.beau_chatter).setOnClickListener(
				new OnClickListener() {
					@Override
					public void onClick(View v) {
						if (mOnItemMenuClickListener != null) {
							mOnItemMenuClickListener
									.onClickChatter(ops, entity);
						}
					}
				});
		holder.getView(R.id.beau_edit).setOnClickListener(
				new OnClickListener() {
					@Override
					public void onClick(View v) {
						if (mOnItemMenuClickListener != null) {
							mOnItemMenuClickListener.onClickEdit(ops, entity);
						}
					}
				});
		ImageView followView = holder.getView(R.id.beau_follow);
		followView
				.setBackgroundResource(t.ismefollow ? R.drawable.ico_beau_follow
						: R.drawable.ico_beau_follow_no);
		holder.getView(R.id.beau_follow).setOnClickListener(
				new OnClickListener() {
					@Override
					public void onClick(View v) {
						if (mOnItemMenuClickListener != null) {
							mOnItemMenuClickListener.onClickFollow(ops, entity);
						}
					}
				});
		final int pp = holder.getPostion();
		holder.getConvertView().setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (mOnClickItem != null) {
					mOnClickItem.onClickItem(pp, entity);
				}
			}
		});
	}

	private void setCurrentSlideItem(int pos) {

		System.arraycopy(mSlideItemArray, 0, mSlideItemArray, 1, 1);
		for (int i = 0; i < mSlideItemArray.length; i++) {
			Log.d("mSlideItemArray", "後面是" + mSlideItemArray[i]);

		}

		mSlideItemArray[0] = pos;
		notifyDataSetChanged();
	}

	public interface OnClickItem {
		void onClickItem(int pos, BeauListEntity t);
	}

	/**
	 * 设置点击侧滑菜单的时候的监听
	 * 
	 * @param beauListFragmentType
	 */
	public void setOnItemMenuClickListener(BeauListFragmentType beauListFragmentType) {
		this.mOnItemMenuClickListener = beauListFragmentType;
	}

	public interface onItemMenuClickListener {

		/**
		 * 点击 电话的时候
		 * 
		 * @param pos
		 * @param t
		 */
		void onClickPhone(int pos, BeauListEntity t);

		/**
		 * 点击chatter
		 * 
		 * @param pos
		 * @param t
		 */
		void onClickChatter(int pos, BeauListEntity t);

		/**
		 * 点击edit
		 * 
		 * @param pos
		 * @param t
		 */
		void onClickEdit(int pos, BeauListEntity t);

		/**
		 * 点击跟随的
		 * 
		 * @param pos
		 * @param t
		 */
		void onClickFollow(int pos, BeauListEntity t);

	}

	@Override
	public int getLayoutId() {
		return R.layout.beau_list_item_type;
	}
}
